<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>generateItems</title>
</head>

<body>
    <script>
        const generateItems = (n, handler) =>
            Array.from({ length: n }, (_, i) => handler(i));
        document.write(`generateItems(10, Math.random)的结果是${generateItems(10, Math.random)}`)
    </script>
</body>

</html>